import unittest
import requests
import json


def yun_login(username, password):
    url = "http://yun.zenm.vip/iot/account/login/"
    header = {
        'Content-type': 'application/json'
    }
    data = {
        'username': username, "password": password
    }
    json_data = json.dumps(data)

    res = requests.post(url=url, headers=header, data=json_data)
    json_data = res.json()
    return json_data